Repository navigation
feat(cli): shell completion for actions and commands - #806
Open
ZhangDM-520 wants to merge 3 commits into
Open
ZhangDM-520 wants to merge 3 commits into
ZhangDM-520 wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Talia preliminary review
| Check | Result |
|---|---|
| Merge score | 🟢 4/5 — No issues found; likely ready after CI and human review |
| Findings | None found |
| Review depth | 3/5 — how thoroughly the changed code could be checked by reading it |
| Coverage | 31 of 31 changed files reviewed |
What Talia checked: Checked completion against the action/IPC grammars (flags, arities, layout/display/region tables and enum order), dispatch paths, and the IPC client refactor (server newline-terminates and closes one-shot replies). Shell scripts and the new 1 MiB reply cap remain unverified.
Run details
- Commit reviewed: 7c8b360
- Source lookups: 70 file reads, 50 searches
- Prompt version: 859b7490ca3d
Preliminary automated review: Talia read the changed code and related source; nothing was built, run or tested, and AI can make mistakes. It is not a scope acceptance or a promise to merge; a human reviewer makes the final call. See our ethos.
Contributor
Author
ZhangDM-520
added a commit
to ZhangDM-520/gsa-recipe
that referenced
this pull request
Nov 15, 2026
The patch was cut at `a8c0eb15` and had gone stale: rounds 14-17 of review landed on the same file, and the last of them fixes a closed quoted word whose prefix bash discarded, so the installed script completed the wrong word. Re-cut at `7c8b360d`, the head of noctalia-dev/umbriel#806. 31 files +2681/-152, sha256 59d89e53. pkgrel 2 so the installed version identifies its content within the same pkgver. Assisted-by: LLM (human-reviewed) Signed-off-by: ZhangDM-520 <jixianqiang1540@gmail.com>
ZhangDM-520
added a commit
to ZhangDM-520/umbriel-nightly
that referenced
this pull request
Nov 19, 2026
ZhangDM-520
added a commit
to ZhangDM-520/umbriel-nightly
that referenced
this pull request
Nov 19, 2026
feat/cli-completions returns resp["ok"] into std::optional<nlohmann::json>. json converts both to optional<json> and to json itself, so the return is ambiguous on GCC 16.2.1, which is what CI builds with. This host carries a GCC 17 snapshot that resolves it, which is why the merge tested green locally and failed in CI. The explicit construction is the minimal disambiguation and changes no behaviour. Upstream should carry it in noctalia-dev#806; nightly records it until then. Assisted-by: LLM (human-reviewed) Signed-off-by: ZhangDM-520 <jixianqiang1540@gmail.com>
ZhangDM-520
added a commit
to ZhangDM-520/umbriel-nightly
that referenced
this pull request
Nov 20, 2026
ZhangDM-520
added a commit
to ZhangDM-520/umbriel-nightly
that referenced
this pull request
Nov 21, 2026
Assisted-by: LLM (human-reviewed) Signed-off-by: ZhangDM-520 <jixianqiang1540@gmail.com>
ZhangDM-520
force-pushed
the
feat/cli-completions
branch
from
November 22, 2026 04:47
7c8b360 to
2401aee
Compare
ZhangDM-520
added a commit
to ZhangDM-520/umbriel-nightly
that referenced
this pull request
Nov 22, 2026
ZhangDM-520
added a commit
to ZhangDM-520/umbriel-nightly
that referenced
this pull request
Nov 22, 2026
Row 3 (noctalia-dev#745) is retired: it landed upstream as 01a7828. C7 is retired: noctalia-dev#806 carries the std::in_place conversion. Thirteen rows were refreshed against the modal scratchpad rework and one (feat/resize-physics) was rebased after a branch-owned conflict stopped the round before any merge. The ten standing recipes are re-derived (C1, C2, C6, C8, C9, C10, C11, C12, C13, C14), the gate stays local, and the falsification results say which unions the suite actually watches.
ZhangDM-520
force-pushed
the
feat/cli-completions
branch
from
December 1, 2026 03:34
2401aee to
7fb2dda
Compare
Each of these spellings existed as a literal at one call site while the parser beside it compared the same text again: the window regions, the revoke-all word, the implicit scratchpad, `toggle`, `current`, `skip-confirmation`, the submap reset word and the `--output`/`--window`/`--name` flags. They move to the header that owns the enum or table, so shell completion can offer the exact word the parser accepts instead of a second copy of it. `actionAllowedFlags` is now the one table mapping an argument kind to the flags it takes, and the parsers read it rather than each passing its own mask. Assisted-by: LLM (human-reviewed) Signed-off-by: ZhangDM-520 <jixianqiang1540@gmail.com>
`umbriel completions <shell>` prints a bash, zsh, or fish script that calls back into `umbriel complete`, so the candidates come from the same tables the parsers read and cannot drift from the grammar: actions and their argument kinds, the IPC command table, and the config registry's own value spellings. Configured names need no session; outputs, window ids, workspaces and effect pools are asked of a running compositor inside one 120 ms deadline covering connect, send and reply, so a stopped or saturated one simply leaves those out. `umbriel complete` exits 2 for a path and 3 for a command line, which hands those positions to the shell. Meson installs the generated scripts for a native build and skips the step on a cross build. Assisted-by: LLM (human-reviewed) Signed-off-by: ZhangDM-520 <jixianqiang1540@gmail.com>
Every closed vocabulary a position offers is asserted to parse through `parseActionWords`, so a word the grammar rejects fails here. The generated bash script is driven in a real shell against a stub `umbriel`, which checks what readline receives rather than the script's text. Assisted-by: LLM (human-reviewed) Signed-off-by: ZhangDM-520 <jixianqiang1540@gmail.com>
ZhangDM-520
force-pushed
the
feat/cli-completions
branch
from
December 2, 2026 09:42
7fb2dda to
0926943
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Adds shell completion to the
umbrielCLI for bash, zsh, and fish.umbriel completions <bash|zsh|fish>prints a script andumbriel complete -- <words>is the callback it calls. Candidates come from the tables the CLI already reads — the action specs and their argument kinds insrc/config/keybind_parse.cpp, the IPC command table insrc/server/ipc_commands.cpp, and the config registry's own value tables — so a position cannot offer a word the grammar rejects, and a rename in one place cannot leave completion behind.Configured names complete with no session. Output names, window ids, workspace names, and effect pool names come from the running compositor inside one 120 ms deadline that covers connect, send, and reply; a stopped, absent, silent, or backlog-saturated compositor leaves those words out and prints nothing. Positions whose words belong to another language hand the position back to the shell:
umbriel completeexits 2 for a path (-c) and 3 for a command line (spawn, the startup-sflag), and the scripts complete paths and command names respectively.Meson installs the three scripts for a native build, and
PACKAGING.mdrecords the installed paths and the cross-build behaviour.docs/user/ipc.mddocuments the two verbs and the budget.Motivation
Action ids and their arguments — layout modes, window regions, stacking anchors, scratchpad and submap names,
--output/--windowtargets — had to be typed from memory or copied out ofumbriel msg --help; live output names and window ids had to be read fromumbriel windows. Completion removes that lookup without adding a protocol, a config key, or a second source of truth for the grammar.Type of Change
Testing
meson test -C build-debug --print-errorlogs --exclude eis-socket→ 160/160 pass; the completion binary runs 36 cases.eis-socket-testfails to link on this host for a pre-existing reason unrelated to the change (GCC 17 / libstdc++ 17std::filesystem::directory_iteratordefault constructor), so the suite andjust lintwere run without it; clang-tidy ran directly over every changed translation unit with--warnings-as-errors='*'and is clean../build-debug/tests/completion-test→ 36 cases. The closed vocabularies are asserted againstparseActionWords, so an offered word that the grammar refuses fails the test. The bash script is driven in a realbashwith a stubumbrielfirst onPATH, so those assertions cover what readline receives rather than the script's own text.just formatandjust format-docs-check→ clean, no diff.meson install -C build-debug --no-rebuild --destdir <dir>→share/bash-completion/completions/umbriel,share/zsh/site-functions/_umbriel,share/fish/vendor_completions.d/umbriel.fish.msg window-c→window-center,window-clear-region,window-close;msg window-set-region→ the eight regions;config→validate,schema;-c→ exit 2 (path);msg spawn ec→echofromcompgen -c;-s→ exit 3.eval "$(umbriel completions zsh)"exits 0 and defines_umbriel;compinitregisters it; calling it as a function still emits candidates, and the delegated positions call_path_filesand_command_names.__umbriel_completepassescomplete -- msg window-c, rendersvalue<TAB>description, and completesmsg spawn ectoechothrough__fish_complete_command.UMBRIEL_COMPLETE_LIVE=0skips the query entirely (14 ms).0) is offered only after--nameand not as a positional; a value beginning with--completes after--name,--outputand--windowbut not positionally;workspace-move-to-output c→current;spawn --jsonexits 2 whilespawnexits 3.meson install --no-rebuild --destdir <dir>strips nothing on a native build; the install step is skipped entirely whenmeson.is_cross_build(), asPACKAGING.mdstates.just check session/action_dispatch→ PASS.Checklist
SCOPE.md, or its scope was agreed in an issue or on Discord first.CONTRIBUTING.md.just format, or this PR has no C++, shader, or Markdown changes.docs/andexamples/config.toml, or this PR does not change user-facing configuration or behavior.Additional Notes
src/cli/complete.cpp,src/cli/completion_script.cpp), the unit test, and the three shell scripts. The compositor-side change is confined to giving each spelling one owner:windowRegionNames, theactionAllowedFlags/actionFlagMaskpair, the flag words,kSkipConfirmationWord,kLayoutModeToggleWord,kCurrentOutputWord,kRevokeAllWordandkImplicitScratchpadare read by the parsers and by completion, and completion reads the configuration's ownregistry::Choicestables (layoutModes(),columnDisplays()) rather than a copy of their names. That is what keeps completion, the word grammar, and the config keys from drifting apart.PACKAGING.mdcross-build note: the install step runs only whenmeson.is_cross_build()is false, so a cross build installs no completion scripts rather than scripts the target cannot regenerate.BashCompletiondrives_umbrieldirectly, so readline's own behaviour — the space it appends after a unique match, its quote-aware replacement — is only exercised by hand in a real shell, and no harness check can see it either. The script has been verified by hand in bash 5 and zsh 5.9 against package names, window ids carrying a colon and an apostrophe, and quoted, spliced and escaped values; review of that layer on behaviour rather than by reading is welcome.